import java.util.StringTokenizer;

class P133_39643 {

    public static void main(String[] args) {
    	int N, k, m;
    	StringTokenizer st = new StringTokenizer(readLn());
    	N = Integer.parseInt(st.nextToken());
    	k = Integer.parseInt(st.nextToken());
    	m = Integer.parseInt(st.nextToken());
    	
    	while (N != 0 && k != 0 && m != 0) {
    		process(N, k, m);
    		st = new StringTokenizer(readLn());
        	N = Integer.parseInt(st.nextToken());
        	k = Integer.parseInt(st.nextToken());
        	m = Integer.parseInt(st.nextToken());
    	}
    	
    }

    private static void process(int N, int k, int m) {
    	boolean[] applicants = new boolean[N];
    	int remaining_applicants = N;
    	
    	int index_k = 0;
    	int index_m = N-1;
    	
    	StringBuffer answer = new StringBuffer();
    	
    	while (remaining_applicants > 0) {
//    		System.out.print("_");
    		int counter_k = k - 1;
        	int counter_m = m - 1;
        	
        	while (counter_k > 0 || counter_m > 0) {
//        		System.out.print(".");
//        		for (boolean b : applicants) {
//        			System.out.print(b + " ");
//        		}
        		if (counter_k > 0) {
        			index_k = getNextCCW(index_k, applicants);
        			counter_k--;
        		}
        		
        		if (counter_m > 0) {
        			index_m = getNextCW(index_m, applicants);
        			counter_m--;
        		}
        		
        	}

        	applicants[index_k] = true;
        	applicants[index_m] = true;
        	
        	if (index_k == index_m) {
        		remaining_applicants--;
        		answer.append(format(index_k) + ",");
        	} else {
        		remaining_applicants--;
        		remaining_applicants--;
        		answer.append(format(index_k) + format(index_m) +",");
        	}
        	
        	if (remaining_applicants > 0) {
	        	index_k = getNextCCW(index_k, applicants);
	        	index_m = getNextCW(index_m, applicants);
        	}
        	
    	}
    	
    	System.out.println(answer.toString().substring(0, answer.length()-1));
    	
	}

	private static String format(int value) {
		String s = Integer.toString(value+1);
		for (int k = s.length(); k < 3; k++) {
			s = " " + s;
		}
		return s;
	}

	private static int getNextCCW(int index_m, boolean[] applicants) {
		while (true) {
//			System.out.print("-CCW");
			index_m++;
			if (index_m == applicants.length) index_m = 0;
			if (!applicants[index_m]) return index_m;
		}
	}

	private static int getNextCW(int index_k, boolean[] applicants) {
		while (true) {
//			System.out.print("-CW");
			index_k--;
			if (index_k == -1) index_k = applicants.length - 1;
			if (!applicants[index_k]) return index_k;
		}
	}

	static String readLn() {
        String newLine = System.getProperty("line.separator");
        StringBuffer buffer = new StringBuffer();
        int car = -1;
        try {
            car = System.in.read();
            while ((car > 0) && (car != newLine.charAt(0))) {
                buffer.append((char)car);
                car = System.in.read();
            }
            if (car == newLine.charAt(0))
            System.in.skip(newLine.length() - 1);
        } catch (java.io.IOException e) { return (null);}
        if ((car < 0) && (buffer.length() == 0)) return (null);
        return (buffer.toString()).trim();
    }

}